﻿package evo.engine
{
	public class Tick
	{
		private var listeners:Array=new Array();
		
		public function addListener(func:Function):void {
			listeners.push(func);
		}
		
		public function removeListener(func:Function):void {
			var tmp:Function = function(f:*, idx:int, arr:Array):Boolean {
				return f != func;
			}
			listeners=listeners.filter(tmp);
		}
		
		public function run(t:uint):void {		
//			for each(var f:Function in listeners) f(t);
			var i:int = listeners.length;
			while(i>0)
			{
				i--;
				listeners[i](t);
			}
		}
	}
}